require 'erb'

before "deploy:setup", :prepare_chacheable
after "deploy:update_code", "prepare_chacheable:change_perms" 

namespace :prepare_chacheable do
  desc "Create an empty and change perms for base.css and base_js.js" 
  task :default do
    
  end
  
  desc "Make caheable css and JS cacheable" 
  task :change_perms do
    css = ERB.new <<-EOF
      /*empty*/
    EOF
    js = ERB.new <<-EOF
      /*empty*/
    EOF
    
    #run "mkdir -p #{release_path}/public/stylesheets/" 
    #run "mkdir -p #{release_path}/public/javascripts/" 
    
    #put css.result, "#{release_path}/public/stylesheets/base.css" 
    #put js.result, "#{release_path}/public/javascripts/base_js.js"
    #run "chmod 666 #{release_path}/public/stylesheets/" 
    #run "chmod 666 #{release_path}/public/javascripts/" 
    
  end
end
